package zhaoyue725.zyfypt_0725zhaoyue;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView;

public class LoginActivity extends AppCompatActivity {
    Button button,button2;
    CheckBox checkBox;
    EditText editText,editText2;
    TextView textView,textView2,textView3;
    String str;
    String str2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        button = (Button)findViewById(R.id.btn_login);
        button2 = (Button)findViewById(R.id.btn_register);
        editText = (EditText)findViewById(R.id.ed_username);
        editText2 = (EditText)findViewById(R.id.ed_password);
        textView = (TextView)findViewById(R.id.textView);
        textView2 = (TextView)findViewById(R.id.textView2);




        button.setOnClickListener(new View.OnClickListener() {
                                      @Override
                                      public void onClick(View v) {
                                          Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                                          startActivity(intent);
                                      }
});


        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
                startActivity(intent);
            }
        });

        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked)
                    str2 +="记住密码";
                else
                    str2 = str2.replace("记住密码","");
                editText2.setText(str2);

            }
        });


    }

}